#include <stdio.h>
#include <octopus.h>

#ifdef __MINGW_H
#include <windows.h>
#endif

int
main ()
{

  struct octopus_context octopus;

  if (!octopus_init (&octopus))
	 printf ("%s\n", octopus.error_str);

  /* if(octopus_open_serial(&octopus,"20081109")<0){ */

  if (octopus_open (&octopus) < 0)
	 {
		printf ("%s\n", octopus.error_str);
		exit (0);
	 }

  int i;
  #define LENGHT 56
  char desc[65],read[65];
  octopus_get_hwdesc (&octopus, desc);
  printf ("Device: %s\n", desc);

  octopus_get_hwdesc (&octopus, desc);
  printf ("Device: %s\n", desc);


  for(i=0;i<LENGHT;i++) 
    desc[i]=i;


  octopus_eeprom_write_bytes(&octopus, 1, desc, LENGHT);


  octopus_eeprom_read_bytes(&octopus, 1, read, LENGHT);

  for(i=0;i<LENGHT;i++) 
    printf("%x",read[i]);




  if (octopus_close (&octopus) < 1)
	 printf ("ERROR: %s\n", octopus.error_str);

  return 0;


}
